package com.jingtai.platform.controller.pay;

import com.jingtai.core.entity.pay.GoodsRefund;
import com.jingtai.platform.service.pay.GoodsRefundService;
import com.jingtai.platform.util.ResultUtil;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.jingtai.validate.swagger.CApiParam;

/**
 * 商品退款订单表
 *
 * @author sunlaiqian
 * @date 2020-12-02 18:31:33
 */
@Validated
@RestController
@RequestMapping("/platform/goodsrefund")
@Api(tags = "商品退款订单表")
public class GoodsRefundController{

    @Autowired
    private GoodsRefundService goodsRefundService;


    @ApiOperation("商品退款订单表列表查询")
    @GetMapping("/list")
    public ResultUtil aopGoodsRefundList(@CApiParam(name = "page",value = "页数",required = true,cNotEmpty = true,cIntMin = 1) @RequestParam("page") Integer page,
                              @CApiParam(name = "limit",value = "每页个数",required = true,cNotEmpty = true,cIntMin = 1) @RequestParam("limit") Integer limit,
                              @CApiParam(name = "conditions",value = "查询条件",required = false) @RequestParam("conditions") String conditions){
        return goodsRefundService.GoodsRefundlist(page, limit, conditions);
    }


    @ApiOperation("根据ID查询goodsRefund实体")
    @GetMapping("/getGoodsRefundById")
    public ResultUtil GetGoodsRefundById(@CApiParam(name = "id",value = "goodsRefund实体ID",required = true,cNotEmpty = true) @RequestParam("id") Long id){
        return goodsRefundService.getGoodsRefundById(id);
    }


    @ApiOperation("新增goodsRefund实体")
    @PostMapping("/add")
    @ApiOperationSupport(ignoreParameters = {"goodsRefund.id","goodsRefund.createTime","goodsRefund.updateTime","goodsRefund.deleteFlag"})
    public ResultUtil aopAddGoodsRefund(@RequestBody @Validated GoodsRefund goodsRefund){
        return goodsRefundService.addGoodsRefund(goodsRefund);
    }

    @ApiOperation("编辑goodsRefund实体")
    @PostMapping("/edit")
    @ApiOperationSupport(ignoreParameters = {"goodsRefund.createTime","goodsRefund.updateTime","goodsRefund.deleteFlag"})
    public ResultUtil aopEditGoodsRefund(@RequestBody @Validated GoodsRefund goodsRefund){
        return goodsRefundService.editGoodsRefund(goodsRefund);
    }

    @ApiOperation("根据ID删除goodsRefund实体")
    @GetMapping("/delGoodsRefundById")
    public ResultUtil aopDelGoodsRefundById(@CApiParam(name = "id",value = "goodsRefund实体ID",required = true,cNotEmpty = true) @RequestParam("id") Long id){
        return goodsRefundService.delGoodsRefundById(id);
    }

}






